package com.eshop.modules.cart.service.mapper;

import com.eshop.modules.order.service.dto.CountDto;
import java.util.List;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.eshop.modules.cart.domain.StoreCart;
import com.eshop.common.mapper.CoreMapper;

@Repository
public interface StoreCartMapper extends CoreMapper<StoreCart>
{
    @Select({ "select IFNULL(sum(cart_num),0) from store_cart where is_pay=0 and is_del=0 and is_new=0 and uid=#{uid}" })
    int cartSum(@Param("uid") final Long uid);
    
    @Select({ "SELECT t.cate_name as catename from store_cart c  LEFT JOIN store_product p on c.product_id = p.id  LEFT JOIN store_category t on p.cate_id = t.id WHERE c.is_pay = 1" })
    List<CountDto> findCateName();
}
